package com.lkd.controller;

import com.lkd.result.Result;
import com.lkd.service.TaskService;
import com.lkd.vo.TaskVo;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.List;

@RequestMapping("/api/task-service/task")
@RequiredArgsConstructor
@RestController
public class TaskController {
    private final TaskService taskService;

    //工单统计
    @GetMapping("/taskReportInfo/{start}/{end}")
    public Result taskReportInfo(
            @PathVariable("start") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime start,
            @PathVariable("end")    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime end){
        List<TaskVo> taskVo =taskService.taskReportInfo(start,end);
        return Result.success(taskVo);
    }
}
